//
//  IncomeDetailViewController.m
//  Hui
//
//  Created by HawkingWang on 16/10/31.
//  Copyright © 2016年 Hui. All rights reserved.
//

#import "IncomeDetailViewController.h"
#import "IncomeDetailTableViewCell.h"//cell
#import "BindingCardViewController.h"//绑定银行卡Controller
#import "WithdrawApplyViewController.h"//提现申请Controller

@interface IncomeDetailViewController () <UITableViewDelegate, UITableViewDataSource>
/**体现账户*/
@property (weak, nonatomic) IBOutlet UILabel *withdrawAccount;
/**余额*/
@property (weak, nonatomic) IBOutlet UILabel *balance;
/**今日收入*/
@property (weak, nonatomic) IBOutlet UILabel *todayIncome;
/**总收入*/
@property (weak, nonatomic) IBOutlet UILabel *totalIncome;

@property (weak, nonatomic) IBOutlet UITableView *tableView;

@end

@implementation IncomeDetailViewController

 static NSString *const IncomeDetailTableViewCellID = @"IncomeDetailTableViewCell";

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBar.hidden = YES;
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
    
    [_tableView registerNib:[UINib nibWithNibName:@"IncomeDetailTableViewCell" bundle:nil] forCellReuseIdentifier:IncomeDetailTableViewCellID];
}
/**设置银行卡*/
- (IBAction)setCard:(id)sender {
    BindingCardViewController *binding = [[BindingCardViewController alloc] init];
    binding.bindingSucceed = ^(NSString *bankName, NSString *cardNum){
        NSRange range = {4, 13};
        NSString *card = [cardNum stringByReplacingCharactersInRange:range withString:@"****"];
        _withdrawAccount.text = [NSString stringWithFormat:@"%@ %@", bankName, card];
        _withdrawAccount.textColor = RGBCOLOR(59, 68, 75);
        _withdrawAccount.font = [UIFont fontWithName:APPFONTMidium size:15];
    };
    [self.navigationController pushViewController:binding animated:YES];
}

#pragma mark === TableViewDelegate ===
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 3;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 100;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    IncomeDetailTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:IncomeDetailTableViewCellID];
//    [cell loadData:<#(IncomeDetailModel *)#>];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}

#pragma mark === 提现 ===
- (IBAction)withdraw:(id)sender {
    WithdrawApplyViewController *withdraw = [[WithdrawApplyViewController alloc] init];
    [self.navigationController pushViewController:withdraw animated:YES];
}

- (IBAction)back:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
@end
